<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多行省略</title>
    <style>
        .text-div{
            height: 150px;
            width: 300px;
            font-size: 19px;
            border: 1px solid red;
            overflow: hidden;
        }

        .hidden-font1{
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 6;
        }
        .font2-content{
            position: relative;
            padding-right: 19px;
            text-align: justify;
        }
        .hidden-font2::before{
            content: "...";
            position: absolute;
            right: 0;
            bottom: 0;
        }
        /* 用于不需要显示省略号的时候，隐藏省略号 */
        .hidden-font2::after{
            content: "";
            width: 19px;
            height: 19px;
            background: blue;
            position: absolute;
            display: inline;
            right: 0;
        }
        .hidden-font3{
            position:relative;
        }
        .hidden-font3::after{
            content: "";
            position: absolute;
            width: 20%;
            height: 19px;
            background: linear-gradient(to right,rgba(255,255,255,0),blue 80%);
            right: 0;
            bottom: 0;
        }
    </style>
</head>
<body>
    <div class="text-div hidden-font1">
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        新年快乐
    </div><br>
    <div class="text-div font2-content hidden-font2 ">
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        新年快乐
    </div>
    <br>
    <div class="text-div hidden-font3">
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，恭喜发大财，
        新年快乐
    </div>
</body>
</html>